import myRequest from '../request.js'
import dicts from '@/config/dicts.js'

// 查询点赞
export const queryLikes = (type, id) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + `/purchaser/member/like/isLike/${type}/${id}`, 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}
// 添加点赞
export const addLikes = (type, id) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + `/purchaser/member/like/add/${type}/${id}`, 'post').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}
// 删除点赞
export const deleteLikes = (type, id) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + `/purchaser/member/like/delete/${type}/${id}`, 'delete').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}
// 获取视频详细
export const getVideoInfo = (id) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/popularize/video/' + id, 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}
// 获取视频列表
export const getVideoList = (val) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/popularize/video', 'get', val).then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

// 视频大区
export const getVideoRegion = (parentId) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + `/purchaser/market/market/get/${parentId}`, 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

